%module MNISTDataIteratorModule

%import "LibDL/global_typemaps.i"
%import "./LibDL/data/Example/Example.i"

%typemap(javaimports) SWIGTYPE
%{
import LibDL.core.*;
%}

SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)

%typemap(javainterfaces) data::MNISTDataIterator "java.util.Iterator<LibDL.core.data.Example>"
%typemap(javacode) data::MNISTDataIterator %{
  public void remove() throws UnsupportedOperationException {
    throw new UnsupportedOperationException();
  }

  public LibDL.core.data.Example next() throws java.util.NoSuchElementException {
    if (!hasNext()) {
      throw new java.util.NoSuchElementException();
    }

    return nextImpl();
  }
%}

%{
#include "./LibDL/data/MNISTDataIterator/MNISTDataIterator.h"
%}

%nspace data::MNISTDataIterator;
%include "./LibDL/data/MNISTDataIterator/MNISTDataIterator.h"